// import axios from 'axios'axios.defaults.baseURL = process.env.VUE_APP_URL
import request from '@/utils/request.js'

//登录
export function authorizationsPost(data) {
  return request({
    url: '/v1_0/authorizations',
    method: 'post',
    data: data
  })
}
//获取用户信息
export function userProfile(){
    return request ({
        url:'/v1_0/user/profile',
        // headers:{
        //     Authorization:`Bearer ${getItem()}`
        // }
    })
}
//获取频道列表
export function  channels(){
  return request({
    url:'/v1_0/channels',

  })
}
//获取文章列表
export function mpArticles(params){
return request ({
  url:'/v1_0/mp/articles',
  params
})
}
//发表文章
export function mpArticlesPost(data,draft){
  return request ({
    url:'/v1_0/mp/articles',
    method:'post',
    data,
    params:{
      draft
    }
  })
}
//删除文章
export function  mpArticlesDelete(id){
  return request({
    url:'/v1_0/mp/articles/'+id,
    method :'delete'
  })
}
//获取文章详情
export function mpArticlesGet(id){
  return request ({
    url:'/v1_0/mp/articles/'+id
  })
}
//编辑文章
export function  mpArticlesPut(data,draft){
  return request ({
    url:'/v1_0/mp/articles/'+data.id,
    method:'put',
    params:{
      draft
    },
    data
  })
}